/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package py.com.peluq.model.entity;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Diego_M
 */
@Entity
@Table(name = "det_ntadeb_cre", catalog = "peludb", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "DetNtadebCre.findAll", query = "SELECT d FROM DetNtadebCre d"),
    @NamedQuery(name = "DetNtadebCre.findByProdCod", query = "SELECT d FROM DetNtadebCre d WHERE d.detNtadebCrePK.prodCod = :prodCod"),
    @NamedQuery(name = "DetNtadebCre.findByNcrCod", query = "SELECT d FROM DetNtadebCre d WHERE d.detNtadebCrePK.ncrCod = :ncrCod"),
    @NamedQuery(name = "DetNtadebCre.findByCantidad", query = "SELECT d FROM DetNtadebCre d WHERE d.cantidad = :cantidad"),
    @NamedQuery(name = "DetNtadebCre.findByPrecio", query = "SELECT d FROM DetNtadebCre d WHERE d.precio = :precio"),
    @NamedQuery(name = "DetNtadebCre.findByExenta", query = "SELECT d FROM DetNtadebCre d WHERE d.exenta = :exenta"),
    @NamedQuery(name = "DetNtadebCre.findByGrav5", query = "SELECT d FROM DetNtadebCre d WHERE d.grav5 = :grav5"),
    @NamedQuery(name = "DetNtadebCre.findByGrav10", query = "SELECT d FROM DetNtadebCre d WHERE d.grav10 = :grav10")})
public class DetNtadebCre implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected DetNtadebCrePK detNtadebCrePK;
    @Column(name = "cantidad")
    private Integer cantidad;
    @Column(name = "precio")
    private Integer precio;
    @Column(name = "exenta")
    private Integer exenta;
    @Column(name = "grav5")
    private Integer grav5;
    @Column(name = "grav10")
    private Integer grav10;
    @JoinColumn(name = "ncr_cod", referencedColumnName = "ncr_cod", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private NotasDebCred notasDebCred;
    @JoinColumn(name = "prod_cod", referencedColumnName = "prod_cod", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Productos productos;

    public DetNtadebCre() {
    }

    public DetNtadebCre(DetNtadebCrePK detNtadebCrePK) {
        this.detNtadebCrePK = detNtadebCrePK;
    }

    public DetNtadebCre(int prodCod, int ncrCod) {
        this.detNtadebCrePK = new DetNtadebCrePK(prodCod, ncrCod);
    }

    public DetNtadebCrePK getDetNtadebCrePK() {
        return detNtadebCrePK;
    }

    public void setDetNtadebCrePK(DetNtadebCrePK detNtadebCrePK) {
        this.detNtadebCrePK = detNtadebCrePK;
    }

    public Integer getCantidad() {
        return cantidad;
    }

    public void setCantidad(Integer cantidad) {
        this.cantidad = cantidad;
    }

    public Integer getPrecio() {
        return precio;
    }

    public void setPrecio(Integer precio) {
        this.precio = precio;
    }

    public Integer getExenta() {
        return exenta;
    }

    public void setExenta(Integer exenta) {
        this.exenta = exenta;
    }

    public Integer getGrav5() {
        return grav5;
    }

    public void setGrav5(Integer grav5) {
        this.grav5 = grav5;
    }

    public Integer getGrav10() {
        return grav10;
    }

    public void setGrav10(Integer grav10) {
        this.grav10 = grav10;
    }

    public NotasDebCred getNotasDebCred() {
        return notasDebCred;
    }

    public void setNotasDebCred(NotasDebCred notasDebCred) {
        this.notasDebCred = notasDebCred;
    }

    public Productos getProductos() {
        return productos;
    }

    public void setProductos(Productos productos) {
        this.productos = productos;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (detNtadebCrePK != null ? detNtadebCrePK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DetNtadebCre)) {
            return false;
        }
        DetNtadebCre other = (DetNtadebCre) object;
        if ((this.detNtadebCrePK == null && other.detNtadebCrePK != null) || (this.detNtadebCrePK != null && !this.detNtadebCrePK.equals(other.detNtadebCrePK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "py.com.peluq.model.entity.DetNtadebCre[ detNtadebCrePK=" + detNtadebCrePK + " ]";
    }
    
}
